#!/usr/bin/env python3
import os
import sys

argv = sys.argv[1:]

try:
    pkg_name = os.environ['CARGO_PKG_NAME']
except KeyError:
    pass
else:
    if pkg_name == 'proptest':
        try:
            pos = list(zip(argv, argv[1:])).index(('-C', 'link-dead-code'))
        except ValueError:
            pass
        else:
            argv[pos:pos + 2] = []

os.execv('/usr/bin/env', ['env', 'rustc'] + argv)
